package com.ph.myblog.action;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.ph.myblog.entity.Article;
import com.ph.myblog.entity.Articletype;
import com.ph.myblog.services.ArticleServices;
import com.ph.myblog.services.ArticleTypeServices;

public class ArticleTypeAction extends ActionSupport {

	private Articletype type;
	private List<Articletype> list;
	private ArticleTypeServices typeServices = new ArticleTypeServices();


	public String list() throws Exception {
	 
		list = this.typeServices.list();
		return this.SUCCESS;
	}

	public String add() throws Exception {
		this.typeServices.add(type);
		return "add_success";
	}

	public String update() throws Exception {
 
		this.typeServices.update(type);
		return "update_success";
	}

	public String delete() throws Exception {
		this.typeServices.delete(type);
		return "delete_success";
	}

	public String updateInput() throws Exception {
		type = this.typeServices.loadTypeById(type);
		return "update_input";
	}
 
	public Articletype getType() {
		return type;
	}

	public void setType(Articletype type) {
		this.type = type;
	}

	public List<Articletype> getList() {
		return list;
	}

	public void setList(List<Articletype> list) {
		this.list = list;
	}

	public ArticleTypeServices getTypeServices() {
		return typeServices;
	}

	public void setTypeServices(ArticleTypeServices typeServices) {
		this.typeServices = typeServices;
	} 
}
